package com.example.q_kang.hhh.setting;

import com.hjq.toast.ToastUtils;
import com.lzy.okgo.model.Response;
import com.sskj.base.BasePresenter;
import com.sskj.base.api.Constant;
import com.sskj.base.base.HttpData;
import com.example.q_kang.hhh.api.JsonCallBack;


/**
 * @author Hey
 * Create at  2019/04/10
 */
class UserInfoPresenter extends BasePresenter<UserInfoActivity> {

    public void editData(String nickname, String username, String pb_note) {
        httpService.setUserData(nickname, username, pb_note)
                .tag(this)
                .execute(new JsonCallBack<HttpData>() {
                    @Override
                    public void onSuccess(Response<HttpData> response) {
                        HttpData<String> httpData = response.body();
                        ToastUtils.show(httpData.getMsg());
                        if (httpData.getStatus() == Constant.OK) {
                            mView.setUserDataSuccess();
                        }

                    }
                });
//        Api.getInstance().setUserData((String) SPUtils.get(App.INSTANCE, "token", ""), nickname, username, pb_note)
//                .compose(RxUtils.transform())
//                .subscribe(new ApiObserver<String>() {
//                    @Override
//                    public void onSuccess(String data) {
//
//                    }
//                });
    }

}
